package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	"tuowei.com/app/api/apis"
	"tuowei.com/common/middleware"
)

func init() {
	routerCheckRole = append(routerCheckRole, registerApiAddressRouter)
}

// 需认证的路由代码
func registerApiAddressRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.ApiAddress{}
	//购物车收货地址
	v1auth := v1.Group("/address").Use(authMiddleware.MiddlewareFunc()).Use(middleware.CheckLogin)
	{
		//获取学生的收获地址
		v1auth.POST("", api.GetPages)
		//新增学生的收获地址
		v1auth.POST("/add", api.Insert)
		//修改某个地址信息
		v1auth.POST("/update", api.Change)
		//删除地址
		v1auth.POST("/delete", api.Delete)
	}
}
